f = open(r'C:\Users\CXMZZ\Desktop\config.txt', 'r+',encoding="utf-8")
fw = open(r'C:\Users\CXMZZ\Desktop\config_cp.txt', 'w+',encoding="utf-8")

while True:
    line = f.readline()
    if len(line) == 0:
        break
    if "ip" in line or "server" in line:
        print(line)
        fw.write(line)
f.close()
